// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

export global ScreenHistory {
    public function restore() {
        CurrentDisplayedScreen.set_without_history();
    }

    out property<bool> test: false;
    out property<bool> test2: CurrentDisplayedScreen.test;

    public function append_screen() {
        test = true;
    }
}

export global CurrentDisplayedScreen {
    public function set() {
        ScreenHistory.append_screen();
    }

    out property<bool> test: false;
    out property<bool> test2: ScreenHistory.test;

    public function set_without_history() {
        test = true;
    }
}

export component TestCase inherits Window {
    init => {
        CurrentDisplayedScreen.set();
        ScreenHistory.restore();
    }
    out property <bool> test: ScreenHistory.test2 && CurrentDisplayedScreen.test2;
}


/*

```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert(instance.get_test());
```

```rust
let instance = TestCase::new().unwrap();
assert!(instance.get_test());

```

```js
var instance = new slint.TestCase({});
assert(instance.test);
```



*/
